package net.xo68.destiny.manager.service;

import lombok.extern.slf4j.Slf4j;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import net.xo68.destiny.manager.entity.CronTrigger;
import net.xo68.destiny.manager.mapper.CronTriggerMapper;



/** 
 * CronTrigger Service
 * @author wuxie(16349023@qq.com)
 * @date 2020年12月21日 21:43:52
 *
 */
@Slf4j
@Service
public class CronTriggerService{
    
    @Autowired
    private CronTriggerMapper cronTriggerMapper;

    public CronTrigger find(Long jobId) {
        return  cronTriggerMapper.find(jobId);
    }

    public CronTrigger insert(CronTrigger cronTrigger) {
        cronTriggerMapper.insert(cronTrigger);
        return cronTrigger;
    }

    public CronTrigger update(CronTrigger cronTrigger) {
        cronTriggerMapper.update(cronTrigger);
        return cronTrigger;
    }
    
    public int delete(Long jobId) {
        return cronTriggerMapper.delete(jobId);
    }
    
    public List<CronTrigger> list() {
        return cronTriggerMapper.list();
    }
	
	public PageInfo<CronTrigger> list(int pageNumber,int pageSize) {
        PageHelper.startPage(pageNumber, pageSize,true);
        List<CronTrigger> docs = cronTriggerMapper.list();
        PageInfo<CronTrigger> pageInfo = new PageInfo<CronTrigger>(docs);
        return pageInfo;
    }
}